<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增安全代码')" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-role-add">
        <div class="form-group">
            <label class="col-sm-3 control-label ">安全代码：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="hazardCode" id="hazardCode" required >
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">安全描述：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="description" id="description" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">安全指导：</label>
            <div class="col-sm-8">
                <input id="noteText" name="noteText" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script type="text/javascript">
    function submitHandler() {
            add();
    }

    function add() {
        var hazardCode = $("input[name='hazardCode']").val();
        var description = $("input[name='description']").val();
        var noteText = $("input[name='noteText']").val();
        $.ajax({
            cache : true,
            type : "POST",
            url : ctx + "erp/safety/add",
            data : {
                "hazardCode": hazardCode,
                "description": description,
                "noteText": noteText,
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }
</script>
</body>
</html>
